# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=homer-app
pkgver=1.4.34
pkgrel=3
pkgdesc="HOMER 7.x Front-End and API Server"
url="http://sipcapture.io"
arch="x86_64"
license="AGPL-3.0-or-later"
makedepends="go"
install="$pkgname.pre-install"
options="!check" # no test suite
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/homer-app/archive/$pkgver.tar.gz
	https://github.com/sipcapture/homer-app/releases/download/$pkgver/homer-ui-.tgz
	$pkgname.initd
	change-default-locations.patch
	"

build() {
	make modules
	make all
}

check() {
	"release/homer-app_linux_amd64/homer-app" --version
}

package() {
	install -D -m755 release/homer-app_linux_amd64/homer-app "$pkgdir"/usr/bin/homer-app
	install -D -m644 etc/webapp_config.json "$pkgdir"/etc/homer/webapp_config.json
	mkdir -p "$pkgdir"/usr/share/webapps/homer \
		"$pkgdir"/var/log/homer \
		"$pkgdir"/usr/share/licenses/$pkgname
	mv "$srcdir"/dist/3rdpartylicenses.txt \
		"$pkgdir"/usr/share/licenses/$pkgname/3rdpartylicenses.txt
	mv "$srcdir"/dist "$pkgdir"/usr/share/webapps/homer
	install -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
215da7b49f3ad4fd380c0695b7216de774e94fa3d538782d6a464092d2a1419338a4065ef0fbbe098a2b6d18f8cfb3e1fc5d7dba2b6d36b1692f6e7c33049e17  homer-app-1.4.34.tar.gz
6c29f7a61621d5dc4e1f308540c9bf9893feb7b2ecaa7cafbefca9a812d23a9b502e691335ecb1b9ff9f9c43443c662f46b11066a9a946c989b000c495aa5d47  homer-ui-.tgz
2ba4e0403bd6f3b08a3a4d8bf366ec776941b5a29e9728ca2aefbfc663ce64c01f67a2f8f408a777db7921f8f66f93797fb5f056809901d3f25fe39b414b5865  homer-app.initd
9620fb44c6b7b112bb6d2e7259b588de5381304deb25f81158e8327bbb27303447d53ca49af14c28f3cd5b9904e2864780534989bc08c5bf119bad8ad71649f1  change-default-locations.patch
"
